import http from "@/http";

// 品牌推荐分页查询推荐品牌
export const getBrandListAPI = (
  params: IBrandListParams
): RES<IBrandListModel> => http.get("/home/brand/list", { params });

// 品牌推荐批量修改推荐品牌状态
export const switchRecommendStatusAPI = (
  ids: number[],
  recommendStatus: number
): RES<number> =>
  http.post(
    `/home/brand/update/recommendStatus?ids=${ids.join(
      ","
    )}&recommendStatus=${recommendStatus}`
  );

  // 选择品牌
  export const getMallBrandListApi = (params:IUserListParams):RES<IMallBrandList> => http.get("/brand/list",{params})

  // 添加品牌
  export const addBrandApi = (params:IBrandList[]):RES<number> => http.post("/home/brand/create",params)

  // 选择商品
  export const getHotListApi = (params:IUserListParams):RES<IHotListModel> => http.get("/product/list",{params})
  
  // 添加新品
  export const addNewGoodsApi = (params:IBrandList[]):RES<number> => http.post("/home/newProduct/create",params)
  
  // 选择商品
  export const getSubjectListApi = (params:IUserListParams):RES<ISubjectListModel> => http.get("/subject/list",{params})
  
  // 添加新品
  export const addSubjectsApi = (params:IBrandList[]):RES<number> => http.post("/home/recommendSubject/create",params)

// 品牌推荐批量删除推荐品牌
export const deleteBrandAPI = (ids: number[]): RES<number> =>
  http.post(`/home/brand/delete?ids=${ids}`);

// 品牌推荐修改排序
export const sortBrandAPI = (id: number, sort: number): RES<IBrandList> =>
  http.post(`/home/brand/update/sort/${id}?sort=${sort}`);

// 新品推荐分页查询首页新品
export const getNewProductAPI = (
  params: IBrandListParams
): RES<IBrandListModel> => http.get("/home/newProduct/list", { params });

// 新品推荐批量修改首页新品状态
export const switchNewProductStatusAPI = (
  ids: number[],
  recommendStatus: number
): RES<number> =>
  http.post(
    `/home/newProduct/update/recommendStatus?ids=${ids.join(
      ","
    )}&recommendStatus=${recommendStatus}`
  );

// 新品推荐批量删除首页新品
export const deleteNewProductAPI = (ids: number[]): RES<number> =>
  http.post(`/home/newProduct/delete?ids=${ids}`);

// 新品推荐修改排序
export const sortNewProductAPI = (id: number, sort: number): RES<IBrandList> =>
  http.post(`/home/newProduct/update/sort/${id}?sort=${sort}`);

// 人气推荐分页查询推荐
export const getRecommendProductAPI = (
  params: IBrandListParams
): RES<IBrandListModel> => http.get("/home/recommendProduct/list", { params });

// 人气推荐批量修改首页新品状态
export const switchRecommendProductStatusAPI = (
  ids: number[],
  recommendStatus: number
): RES<number> =>
  http.post(
    `/home/recommendProduct/update/recommendStatus?ids=${ids.join(
      ","
    )}&recommendStatus=${recommendStatus}`
  );

// 人气推荐批量删除推荐
export const deleteRecommendProductAPI = (ids: number[]): RES<number> =>
  http.post(`/home/recommendProduct/delete?ids=${ids}`);

// 新品推荐修改排序
export const sortRecommendProductAPI = (
  id: number,
  sort: number
): RES<IBrandList> =>
  http.post(`/home/recommendProduct/update/sort/${id}?sort=${sort}`);

// 专题推荐分页查询推荐
export const getRecommendSubjectAPI = (
  params: IBrandListParams
): RES<IBrandListModel> => http.get("/home/recommendSubject/list", { params });

// 专题推荐批量修改首页新品状态
export const switchRecommendSubjectStatusAPI = (
  ids: number[],
  recommendStatus: number
): RES<number> =>
  http.post(
    `/home/recommendSubject/update/recommendStatus?ids=${ids.join(
      ","
    )}&recommendStatus=${recommendStatus}`
  );

// 专题推荐批量删除推荐
export const deleteRecommendSubjectAPI = (ids: number[]): RES<number> =>
  http.post(`/home/recommendSubject/delete?ids=${ids}`);

// 新品推荐修改排序
export const sortRecommendSubjectAPI = (
  id: number,
  sort: number
): RES<IBrandList> =>
  http.post(`/home/recommendSubject/update/sort/${id}?sort=${sort}`);
